1. Field of the Invention
The present invention relates to an image processing method and apparatus for edition processing of image data and, more particularly, to an image processing method and apparatus for extracting a part of image data.
2. Related Background Art
Editing an image is generally performed by masking a part of image data and extracting only the remaining part of the image. Such a process is hereinafter referred to as a mask process. In many cases, it is required to extract a complicated shape other than rectangle and regular polygon.
However, in such a case, as in the first conventional example, a bit map memory to store the mask data for extraction) which corresponds to the image data in a one-to-one corresponding manner is provided, and an extracting operation is performed for discriminating whether image data is the data to be extracted or the data to be abandoned (i.e. the masked data) in accordance with the mask data stored in the bit map memory and for extracting only desired image data.
However, this method has the drawbacks such that when an image of high resolution is handled, the capacity of the bit map memory for masking increases and the cost rises.
Further, in the case of enlarging the image or the like after extraction due to the mask process, the oblique edge of the mask is notched due to the enlargement of the pixels, so that the boundary portion of the extracted image data is hard to see.
According to the method of the first example mentioned above, in many cases, only the data in a desired region is extracted from one image and the result is written into the designated image memory. Further, in many cases, this image memory is the bit map memory for storing the image data which was generally binarized due to a dither method, a density pattern method, or the like. In this memory, one bit corresponds to one pixel. This is because when an image of high resolution is handled, the cost of the memory for storing the image data is remarkably reduced.
In such a method, in the case of synthesizing a plurality of masked images into the designated image memory, each image is overlappingly written into the memory in accordance with an order and a priority given to the image data which will be written later used. FIGS. 1A and 1B are diagrams for explaining such a method and show the case of synthesizing an image A masked like a circle for simplicity and an image B masked like a heart. The image A is first formed in the memory and the image B is then synthesized, and the overlapped portion of both images shown in FIG. 1A is added to the image B formed later, so that the image B is preferentially processed. This is because the image data in the memory has already been binarized due to a dither method or the like and the source data in the image portion where the image A overlaps has been lost, so that it is impossible to perform the process to give a priority to the image A.
On the other hand, there is a demand for forming portion C where both images overlap such that both images overlap (namely, like transparent images) as shown in FIG. 1B. However, such a need cannot be realized by the conventional method discussed above.
A second conventional mask process, for use in a graphic display controller or the like approximates the extracted mask pattern by a set of several rectangles and the input image (memory) address is produced from the output image address.
An explanation will now be provided as an example of the case where a part of original image data shown in FIG. 2A is extracted to thereby obtain a desired image, e.g., an image shown in FIG. 2B or the case where a part of the original image data is deleted to thereby derive a desired image, e.g., an image shown in FIG. 2C.
In this case, a mask pattern for extraction or deletion becomes a hatched portion 4 shown in FIG. 3.
In the case of the foregoing first example, the mask pattern portion 4 in an original image region 5 shown in FIG. 3 is held in a bit map mask memory in a one-to-one corresponding manner. For example, "1" is stored into the memory corresponding to the hatched portion 4 and "0" is stored into the memory corresponding to the white (i.e., blank) portion 5. The content of this bit map memory is read out synchronously with the original image shown in FIG. 2A. In this case, if "1" is effective, the image shown in FIG. 2B will be obtained. If "0" is effective, the image shown in FIG. 2C will be derived.
FIG. 4 shows a block diagram of a conventional mask data producing section to implement the first example.
In FIG. 4, reference numeral 8 denotes a bit map memory; 10 is a sub scan counter; 11 is a main scan counter; 15 is a latch; 16 denotes an image start signal; 17 denote a main scan start signal; and 18 denotes a pixel clock signal.
The counters 10 and 11 are reset by the image start signal 16 and main scan start signal 17, respectively. The main scan counter 11 is sequentially counted up in response to the given pixel clock signal 18. The content (mask bits) in the bit map memory 8 which was addressed by the main scan address value indicated by the main scan counter 11 and the sub scan address value indicated by the sub scan counter 10 is read out and latched into the latch 15 and then output. On the other hand, the counter 10 is counted up by the main scan start signal 17.
FIG. 5 shows an example of storage of the mask pattern shown in FIG. 3 in the conventional bit map memory 8.
In the bit map memory 8, the memory cell selected by a sub scan address 10 and a main scan address 11 is read out. For example, when the content is "0", the image is not copied. When it is "1", the copying process of the image is executed.
The case of obtaining the images shown in FIGS. 2B and 2C in to the second example will now be described.
In this case, the one-to-one corresponding mask bit pattern is not held and, for example, the region 4 shown in FIG. 3 has such a shape that triangles are combined and this region is approximated by a set of rectangles, thereby executing the extracting process.
FIG. 6 shows an example of a set of the approximated rectangular extraction patterns.
In this example, the rectangular patterns are extracted by parameters (X.sub.1, Y.sub.1), (X.sub.2, Y.sub.2), (X.sub.3, Y.sub.3), . . . , (X.sub.8, Y.sub.8) indicative of a set of rectangles.
Namely, when the addresses (X, Y) for the output pixel satisfy the following relations: ##EQU1## the pixel at the relevant address position is extracted (or deleted), or the like. The image patterns processed by the above method are shown in FIGS. 7A and 7B. FIG. 7A corresponds to FIG. 2B. FIG. 7B corresponds to FIG. 2C.
In the foregoing first example, the mask memory of the bit map must have the same capacity as the image data. In such a constitution as shown in FIG. 5, in the case of the pixels of 1024 dots .times.1024 dots, it is necessary to use a mask memory of a large capacity as much as 1 Mbits.
On the other hand, the actual mask pattern to be stored to the mask memory is not a perfect curve. For example, as a mask pattern for the image data of the hatched portion shown in FIG. 8, a pattern as shown in FIG. 9 is stored to the bit map mask memory. Thus, the pattern to be stored inevitably becomes stairway shaped on a pixel unit basis.
Therefore, in the case where after this image data was extracted and enlarged, it is multiplexed with another image, or the like, the extracted portion is enlarged due to the bit map of the rectangular pixels and the stairway shape in the boundary portion is also simultaneously enlarged, so that the reproduced image will become hard to see.
Further, in the case of the second example, since an image is subjected to the mask process as a rectangular figure, the extraction shape is limited and it is difficult to perform image converting processes such as enlargement, rotation, and the like, simultaneously with the extracting process and the like. In addition, in the enlarging process, the extracted shape inevitably becomes the fairly emphasized stairway shape, so that the reproduced image will become even more difficult to see.